package com.ruoyi.project.business.domain.rules.daily;

import com.ruoyi.project.business.domain.entity.Emp;
import com.ruoyi.project.business.domain.model.JudgeResult;
import com.ruoyi.project.business.domain.model.Solution;
import com.ruoyi.project.business.domain.rules.Rule;
import com.ruoyi.project.business.timeperiod.entity.TimePeriod;
import lombok.Data;

import java.time.LocalTime;
import java.util.ArrayList;

/**
 * 智能排班(日排班): 不期望的时间段
 */
@Data
public class UnExpectedTime extends Rule {
    private LocalTime segementStart;
    private LocalTime segementEnd;

    // 待确认时间段
    private TimePeriod tryBingo;

    @Override
    public JudgeResult judge(Solution solution, Emp emp) {
        boolean ifCondition = doJudge();
        if(ifCondition) {
            return accept();
        } else {
            if (getBreakIfReject()) {
                return stopTask();
            } else {
                return acceptAndReturn();
            }
        }
//        throw new RuleException(this.getClass().getName(), -1);
    }

    private boolean doJudge() {
        return true;
    }

    @Override
    public void setConflicts() {
        setType(Rule.RULE_TYPE_USER);
        this.conflicts = new ArrayList<>();
    }
}
